//
//  YZAboutProductTableViewController.m
//  kuaiyi
//
//  Created by 刘邓诏初 on 16/5/5.
//
//

#import "YZAboutProductTableViewController.h"

#import "YZAboutProductHeaderView.h"
#import "YZAboutProductFooterView.h"
#import "YZAboutProductTableViewCell.h"
#import "YZUserAgreementViewController.h"

@interface YZAboutProductTableViewController ()
@property(nonatomic,strong)YZAboutProductHeaderView *aboutHeaderView;
@property(nonatomic,strong)YZAboutProductFooterView *aboutFooterView;
@end

@implementation YZAboutProductTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // 设置表头和表尾
    self.tableView.tableHeaderView = self.aboutHeaderView;
    //    self.aboutHeaderView.backgroundColor = [UIColor redColor];
    self.tableView.tableFooterView = self.aboutFooterView;
    //    self.aboutFooterView.backgroundColor = [UIColor yellowColor];
    
    // 设置表的属性
    self.tableView.showsVerticalScrollIndicator = NO;
    self.tableView.contentInset = UIEdgeInsetsMake(0, 0, -2000, 0);
    
    self.title = @"关于产品";
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

#pragma mark - 数据源和代理

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (YZAboutProductTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    YZAboutProductTableViewCell *cell = [YZAboutProductTableViewCell aboutProductTableViewCell:tableView];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    YZUserAgreementViewController * vc = [[YZUserAgreementViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

#pragma mark - 懒加载
- (YZAboutProductHeaderView *)aboutHeaderView{
    if (_aboutHeaderView == nil) {
        _aboutHeaderView = [YZAboutProductHeaderView aboutProductHeaderView];
        
        _aboutHeaderView.frame = CGRectMake(0, 0, 0, [UIScreen mainScreen].bounds.size.height * 0.4);
    }
    return _aboutHeaderView;
}

- (YZAboutProductFooterView *)aboutFooterView{
    if (_aboutFooterView == nil) {
        _aboutFooterView = [YZAboutProductFooterView aboutProductFooterView];
        _aboutFooterView.frame = CGRectMake(0, 0, 0, [UIScreen mainScreen].bounds.size.height * 0.4);
    }
    return _aboutFooterView;
}

@end
